//KSP-TourBus - Kerbal Space Program: Drive a Tour Bus at KSC!

CONTRACT_TYPE
{


//REQUIREMENTS FOR CONTRACT TO APPEAR

	REQUIREMENT
	{
		name = PartUnlocked
		type = PartUnlocked
		
		part = seatExternalCmd

	}
	
	REQUIREMENT
	{
		name = Any
		type = Any

		REQUIREMENT
		{
			name = PartModuleTypeUnlocked
			type = PartModuleTypeUnlocked
			
			partModuleType = Wheel
			
		}	
		
	}

//DATA NODES TO PROCESS FOR CONTRACT USE

//Contract Specific VesselParameterGroup Definition Key (to prevent conflict with other active contracts)
	DATA
	{
		type = string
		
		craft = GAPcraftKSPTourBus
		
	}

//KSP Visitors
	DATA
	{
		type = List<Kerbal>
		kerbalsKSC = [ NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal(), NewKerbal() ]
		
	}


//CONTRACT DESCRIPTION

	name = KSP-TourBusBug
	title = Drive a Tour Bus at KSC! BUG TEST
	group = Kerbal Space Program
	agent = Kerbal Space Program
	
	description = The Kerbal Space Center receives a steady stream of visitors, scientists, and VIPs that would like to be driven around on a tour of KSC. Gene says you never know who you'll pick up, but the KSC tour itself has helped raise money or the reputation of the various organizations at KSC, and has even brought scientists together. He wants you to go pick up the latest group at the Astronaut Complex, and shuttle them around KSC in a tour bus.

	synopsis = Pick up 6 tourists at the Astronaut Complex and take them to every waypoint. Recover them all at the Administration Building.
	
	notes = If you need a little funds, science, or reputation for your program, this is a very slow, but honest way to earn it.
	
	completedMessage = The tour was a success! Gene says the visitors took great pictures, asked amazing questions, and everyone benefitted from the tour.
	
//Contract Limits
   	maxCompletions = 0
   	maxSimultaneous = 1
	weight = 10.0

	autoAccept = false
	declinable = true
	cancellable = true

	minExpiry = 7.0
	maxExpiry = 7.0
	deadline = 0

//Contract Reward Modifiers
	prestige = Trivial
   	targetBody = Kerbin

//Contract Rewards
  	advanceFunds = 0.0
	rewardFunds = 1000
	rewardReputation = 1.0
 	rewardScience = 1.0
	
//Contract Penalties
  	failureFunds = 500.0
 	failureReputation = 1.0


//BEHAVIOURS TO DO WHEN CREATING CONTRACT

	BEHAVIOUR
	{
		name = SpawnKerbal
		type = SpawnKerbal

		KERBAL
		{
		
			kerbal = @/kerbalsKSC.ElementAt(0)
			kerbalType = Unowned
			owned = false
			addToRoster = false
			
			pqsCity = KSC
			pqsOffset = -443.907901603117, 127.74080747695, 25.0254705804591
			alt = 75
			heading = 22

		}
		
		KERBAL
		{
		
			kerbal = @/kerbalsKSC.ElementAt(1)
			kerbalType = Unowned
			owned = false
			addToRoster = false
			
			pqsCity = KSC
			pqsOffset = -444.314768275966, 126.777465233339, 25.025471162664
			alt = 75
			heading = 21

		}
		
		KERBAL
		{
		
			kerbal = @/kerbalsKSC.ElementAt(2)
			kerbalType = Unowned
			owned = false
			addToRoster = false
			
			pqsCity = KSC
			pqsOffset = -444.730876355643, 125.901493676569, 25.025489185
			alt = 75
			heading = 20

		}
		
		KERBAL
		{
		
			kerbal = @/kerbalsKSC.ElementAt(3)
			kerbalType = Unowned
			owned = false
			addToRoster = false
			
			pqsCity = KSC
			pqsOffset = -445.125863464778, 124.968111700171, 25.0254498097784
			alt = 75
			heading = 15

		}
		
		KERBAL
		{
		
			kerbal = @/kerbalsKSC.ElementAt(4)
			kerbalType = Unowned
			owned = false
			addToRoster = false
			
			pqsCity = KSC
			pqsOffset = -444.640582419146, 124.16379743656, 25.0254950290055
			alt = 75
			heading = 4

		}
		
		KERBAL
		{
		
			kerbal = @/kerbalsKSC.ElementAt(5)
			kerbalType = Unowned
			owned = false
			addToRoster = false
			
			pqsCity = KSC
			pqsOffset = -444.816645141898, 123.443007472015, 25.0255001622972
			alt = 75
			heading = 328

		}
		
	}
	
	BEHAVIOUR
	{
        name = WaypointGenerator
        type = WaypointGenerator
		
		PQS_CITY
		{
			name = Astronaut Complex
			icon = marker
			
			pqsCity = KSC
			pqsOffset = -442.023973235631, 130.851555233741, 25.4368833075387
			altitude = 5
			
		}
		
		PQS_CITY
		{
			name = Space Center
			icon = marker
			
			pqsCity = KSC
			pqsOffset = -199.917096819299, 169.648987401799, 25.4046314417319
			altitude = 5
			
		}
		
		PQS_CITY
		{
			name = Tracking Station
			icon = marker
			
			pqsCity = KSC
			pqsOffset = -104.72171727426, -171.137778944692, 25.4729950999099
			altitude = 5
			
		}
		
		PQS_CITY
		{
			name = R&D Center
			icon = marker
			
			pqsCity = KSC
			pqsOffset = -446.649857779978, -161.387740734775, 25.5017392180753
			altitude = 5
			
		}
		
		PQS_CITY
		{
			name = Administration Building
			icon = marker
			
			pqsCity = KSC
			pqsOffset = -635.450871107884, 44.6770752507737, 25.391827671981
			altitude = 5
			
		}
	
	}
	
//PARAMETERS FOR CONTRACT COMPLETION

//Craft definition
	PARAMETER
	{
		name = VesselParameterGroup
		type = VesselParameterGroup
		title = Your vehicle must
		
		define = @/craft
		dissassociateVesselsOnContractCompletion = true
		
		PARAMETER
		{
			name = HasCrew
			type = HasCrew
			title = have a driver
			
			minCrew = 1
			
			disableOnStateChange = false
			hideChildren = true
			
		}		

		PARAMETER
		{
			name = PartValidation
			type = PartValidation
			title = have at least 6 EAS-1 External Command Seats
			
			part = seatExternalCmd
			
			minCount = 6
			
			disableOnStateChange = false
			hideChildren = true
			
		}
		
		PARAMETER
		{
			name = VisitWaypoint
			type = VisitWaypoint
			title = go to the Astronaut Complex
			
			index = 0
			distance = 10
			hideOnCompletion = true
			
			completeInSequence = true
			disableOnStateChange = true
			hideChildren = true
			
		}

		PARAMETER
		{
			name = All
			type = All
			title = and pick up all passengers

			PARAMETER
			{
				name = HasCrew
				type = HasCrew
				title = @kerbal.First()
		
				ITERATOR
				{
					type = Kerbal
					kerbal = @/kerbalsKSC
					
				}
				
				hideChildren = true
				
			}
			
			completeInSequence = true
			disableOnStateChange = false
			
		}
		
		completeInSequence = true
		disableOnStateChange = false
		
	}

//Contract Goals
	
	PARAMETER
	{
		name = VesselParameterGroup
		type = VesselParameterGroup
		title = drive to the Space Center
		
		vessel = @/craft
		
		PARAMETER
		{
			name = VisitWaypoint
			type = VisitWaypoint
			
			index = 1
			distance = 30
			hideOnCompletion = true

		}
		
		completeInSequence = true
		disableOnStateChange = true
		hideChildren = true
		
	}

	PARAMETER
	{
		name = VesselParameterGroup
		type = VesselParameterGroup
		title = drive to the Tracking Station
		
		vessel = @/craft
		
		PARAMETER
		{
			name = VisitWaypoint
			type = VisitWaypoint
			
			index = 2
			distance = 30
			hideOnCompletion = true

		}
		
		disableOnStateChange = true
		hideChildren = true
		
	}
	
	PARAMETER
	{
		name = VesselParameterGroup
		type = VesselParameterGroup
		title = drive to the R&D Center
		
		vessel = @/craft
		
		PARAMETER
		{
			name = VisitWaypoint
			type = VisitWaypoint
			
			index = 3
			distance = 30
			hideOnCompletion = true

		}
		
		disableOnStateChange = true
		hideChildren = true
		
	}
	
	PARAMETER
	{
		name = VesselParameterGroup
		type = VesselParameterGroup
		title = drive to the Administration Building
		
		vessel = @/craft
		
		PARAMETER
		{
			name = VisitWaypoint
			type = VisitWaypoint
			
			index = 4
			distance = 30
			hideOnCompletion = true

		}
		
		disableOnStateChange = true
		hideChildren = true
		
	}
	
//Recovery Parameter - Craft & Kerbal Safety Check
	PARAMETER
	{
		name = All
		type = All
		title = safely
		
		PARAMETER
		{
			name = VesselNotDestroyed
			type = VesselNotDestroyed
			title = without destroying your craft
			
			vessel = @/craft

		}
		
		PARAMETER
		{
			name = KerbalDeaths
			type = KerbalDeaths
			title = or killing anyone
			
			countMax = 1

		}
		
		completeInSequence = true
		disableOnStateChange = true
		
	}
	
//Recovery Parameter - Recover Kerbals
	PARAMETER
	{
		name = All
		type = All
		title = and recover
		
		PARAMETER
		{
			name = RecoverKerbal
			type = RecoverKerbal
			title = @kerbal.First()
	
			ITERATOR
			{
				type = Kerbal
				kerbal = @/kerbalsKSC
				
			}
			
			hideChildren = true
			
		}
		
	}
	
}